package mrusanov.buildings

import mrusanov.team.Club
import mrusanov.money.BuildingMoneyChangeReason

class ClubBuildings(club:Club) {
  val arena = new Arena(this)
  val hospital = new Hospital(this)
  val juniorsSchool = new JuniorsSchool(this)
  val masseurRoom = new MasseurRoom(this)
  val psychologistRoom = new PsychologistRoom(this)
  val trainingBase = new TrainingBase(this)

  private val allBuildings = Set(arena, hospital, juniorsSchool,
    masseurRoom, psychologistRoom, trainingBase)

  def increaseLevel(building:Building) {
    require(allBuildings.contains(building), "Building doesn't belong to this club")
    club.clubBudget.acceptMoneyChangeReason(BuildingMoneyChangeReason(building.upgradeCost))
    building.buildingLevel += 1
    building.usageLevel = building.buildingLevel

  }
}
